package variable

const ON_ClIENT_TASK_FINISH string = "ON_TASK_FINISH"
const ON_SERVER_ACCEPT_TASK_FINISH string = "ON_TASK_FINISH"
const ON_CONNECT_SERVER string = "ON_CONNECT_SERVER"
const ON_REGISTER_SERVER string = "ON_REGISTER_SERVER"
const ON_TCP_CLOSED string = "ON_TCP_CLOSED"
const ON_ASK_FOR_MASTER string = "ASK_FOR_MASTER"               //其他节点寻找主节点
const ON_RESPONSE_MASTER string = "ON_RESPONSE_MASTER"          //当其他节点返回主节点信息
const ON_ASK_CONNECT_SERVER = "ON_ASK_CONNECT_SERVER"           //其他节点要求连接到节点 旨在构成一个网状的网络结构
const ON_LAUNCH_VOTE = "ON_LAUNCH_VOTE"                         //发起投票请求
const ON_ACCEPT_VOTE = "ON_ACCEPT_VOTE"                         //接受到选举结果
const ON_LOSE_CONNECTION = "ON_LOSE_CONNECTION"                 //当发生断开连接的时候除非
const ON_TRY_KEEPALIVE = "ON_TRY_KEEPALIVE"                     //尝试连接断开的连接
const ON_LOG = "ON_LOG"                                         //记录日志通知ws客户端
const ON_WS_RECORD_NODES = "ON_WS_RECORD_NODES"                 //通知ws各节点情况
const ON_WS_NOTICE_DISCONNECTION = "ON_WS_NOTICE_DISCONNECTION" //通知ws断开连接
const ON_PUSH_TASK = "ON_PUSH_TASK"
const ON_POST_SERVER_UNIQUE_ID = "ON_POST_SERVER_UNIQUE_ID"                     //服务向客户端报告uniqueId
const ON_AS_MASTER = "ON_AS_MASTER"                                             //节点被选举为中心节点
const ON_DISTRIBUTE_SOURCE = "ON_DISTRIBUTE_SOURCE"                             //中心节点向子节点分发数据
const ON_BUILD_ENV = "ON_BUILD_ENV"                                             //构建Python的执行环境
const ON_RUN_TASK = "ON_RUN_TASK"                                               //收到运行任务的命令
const ON_FINISH_TASK_PY = "ON_FINISH_TASK_PY"                                   //当python任务节点执行完毕
const ON_DDS_SAVE = "ON_DDS_SAVE"                                               //当中心节点向各个子节点分发数据
const ON_CALLBACK_EVENT = "ON_CALLBACK_EVENT"                                   //其他节点会发送一个callback 系统会触发一个真实的事件是事件然后获取真实的时间的返回结果 返回到原本的主机上
const ON_DDS_ASK_DATA = "ON_DDS_ASK_DATA"                                       //某个节点要求发送数据
const ON_MASTER_DISCONNECTED = "ON_MASTER_DISCONNECTED"                         //当主节点断开连接
const ON_TASK_NODE_LOG = "ON_TASK_NODE_LOG"                                     //当任务节点输出日志的时候 可用于调试
const ON_TASK_NODE_RESULT = "ON_TASK_NODE_RESULT"                               //当任务节点结束并且输出数据
const ON_TASK_NODE_REMOTE_FORK = "ON_TASK_NODE_REMOTE_FORK"                     //当任务节点进行远程调用的时候
const ON_TASK_NODE_REMOTE_FORK_TO_MASTER = "ON_TASK_NODE_REMOTE_FORK_TO_MASTER" //当任务节点进行远程调用的时候并且将此请求发送到主节点
const ON_INSTALL_PACKAGE = "ON_INSTALL_PACKAGE"                                 //安装某个python的依赖包
const ON_CHILDREN_TASK_FINISHED = "ON_CHILDREN_TASK_FINISHED"                   //当子任务执行完成之后此结果将被发送到对应的进程
const ON_TASK_REMOTE_FORK_TO_MASTER = "ON_TASK_REMOTE_FORK_TO_MASTER"           //当子任务执行完成之后此结果将被发送到对应的进程
const ON_SEND_TO_ALL_WS_CLIENT = "ON_SEND_TO_ALL_WS_CLIENT"                     //发送请求数据到所有的websocket 节点
const ON_MASTER_SEND_TO_ALL_WS = "ON_MASTER_SEND_TO_ALL_WS"                     //主节点给所有的ws广播数据
const ON_SERVER_SEND_STATUS = "ON_SERVER_SEND_STATUS"                           //服务器发送

var EventMap map[string]string = map[string]string{
	ON_ClIENT_TASK_FINISH: "OnClientTaskFinish",
}

var EventServerMap map[string]string = map[string]string{
	ON_REGISTER_SERVER:            ON_REGISTER_SERVER,
	ON_ASK_CONNECT_SERVER:         ON_ASK_CONNECT_SERVER,
	ON_ASK_FOR_MASTER:             ON_ASK_FOR_MASTER,
	ON_RESPONSE_MASTER:            ON_RESPONSE_MASTER,
	ON_PUSH_TASK:                  ON_PUSH_TASK,
	ON_ACCEPT_VOTE:                ON_ACCEPT_VOTE,
	ON_POST_SERVER_UNIQUE_ID:      ON_POST_SERVER_UNIQUE_ID,
	ON_DISTRIBUTE_SOURCE:          ON_DISTRIBUTE_SOURCE,
	ON_BUILD_ENV:                  ON_BUILD_ENV,
	ON_RUN_TASK:                   ON_RUN_TASK,
	ON_FINISH_TASK_PY:             ON_FINISH_TASK_PY,
	ON_DDS_SAVE:                   ON_DDS_SAVE,
	ON_DDS_ASK_DATA:               ON_DDS_ASK_DATA,
	ON_CALLBACK_EVENT:             ON_CALLBACK_EVENT,
	ON_LAUNCH_VOTE:                ON_LAUNCH_VOTE,
	ON_TASK_REMOTE_FORK_TO_MASTER: ON_TASK_REMOTE_FORK_TO_MASTER,
	ON_SEND_TO_ALL_WS_CLIENT:      ON_SEND_TO_ALL_WS_CLIENT,
	ON_MASTER_SEND_TO_ALL_WS:      ON_MASTER_SEND_TO_ALL_WS,
	ON_SERVER_SEND_STATUS:         ON_SERVER_SEND_STATUS,
	ON_INSTALL_PACKAGE:            ON_INSTALL_PACKAGE,
}

var TaskServerEvent map[string]string = map[string]string{
	ON_TASK_NODE_LOG:         ON_TASK_NODE_LOG,
	ON_TASK_NODE_RESULT:      ON_TASK_NODE_RESULT,
	ON_TASK_NODE_REMOTE_FORK: ON_TASK_NODE_REMOTE_FORK,
}

func GetEventMap(event string) string {
	return EventMap[event]
}
